<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>注册页面</title>
<link rel="stylesheet" type="text/css" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css" />
<script  src="./js/vue.js"></script>
<script src="./js/axios.min.js"></script>
</head>
<body>
	<div id="app" class="container">
		<h1>{{msg}}</h1>
		<label class="form-title" for="username"><h4>用户名:</h4></label>
		<input id="username" type="text" v-model="user.username" placeholder="请输入注册用户名"/><br>
		<label class="form-title" for="password"><h4>密码:</h4></label>
		<input id="password" type="password" v-model="user.password" placeholder="请输入注册密码" /><br>
		<label class="form-title" for="telnum"><h4>手机号:</h4></label>
		<input id="telnum" type="text" v-model="user.telnum" placeholder="请输入注册电话号" /><br>
		<button type="button" v-on:click="register()">注册</button>
	
	</div>
</body>
</html>
<script>
var vue=new Vue({
    el:'#app',
    data:{
        msg:'用户注册',
        user:{
        	username:'',
            password:'',
            telnum:''
        }
    },
    methods:{
        register:function(){
            axios.post('/ZhuCeDengLu/my/register.do',this.user).then(function(result){
                console.log(result);
                if(result.data.status=="0"){
                	alert("注册成功");
                    document.location.href='login.html';
                }else{
                    alert("注册失败");
                }
            }).catch(function(err){
                alert('您的网络不给力呀~');
            })
        }

    },
    mounted:function(){
        console.log('inited..');
    }
});
</script>